import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [
        // 首页
        {
            path: '/',
            name: 'Home',
            component: () => import('../views/Home/index.vue'),
            meta: {
              isLogin: false,
              isFooter: true
            }
        },

        // 分类
        {
          path: '/category',
          name: 'Category',
          component: () => import('../views/Category/index.vue'),
          meta: {
            isLogin: false,
            isFooter: true
          }
        },

        // 购物车
        // {
        //   path: '/cart',
        //   name: 'Cart',
        //   component: () => import('../views/Cart/index.vue'),
        //   meta: {
        //     isLogin: true,
        //     isFooter: true
        //   }
        // },

        // 我的
        {
          path: '/me',
          name: 'Me',
          component: () => import('../views/Me/index.vue'),
          meta: {
            isLogin: true,
            isFooter: true
          }
        },

        // 用户注册
        {
          path: '/register',
          name: 'Register',
          component: () => import('../views/Register/index.vue'),
          meta: {
            isLogin: false,
            isFooter: true
          }
        },

        // 找回密码
        {
          path: '/forgotPassword',
          name: 'ForgotPassword',
          component: () => import('../views/ForgotPassword/index.vue'),
          meta: {
            isLogin: false,
            isFooter: true
          }
        },

        // 密码登录
        {
          path: '/passwordLogin',
          name: 'PasswordLogin',
          component: () => import('../views/Login/passwordLogin.vue'),
          meta: {
            isLogin: false,
            isFooter: false
          }
        },

        // 短信登录
        {
          path: '/messageLogin',
          name: 'MessageLogin',
          component: () => import('../views/Login/messageLogin.vue'),
          meta: {
            isLogin: false,
            isFooter: false
          }
        },


        // 个人设置
        {
          path: '/userSet',
          name: 'UserSet',
          component: () => import('../views/UserSet/index.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 其他信息
        {
          path: '/otherInfo',
          name: 'OtherInfo',
          component: () => import('../views/UserSet/otherInfo.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 修改昵称
        {
          path: '/editNick',
          name: 'EditNick',
          component: () => import('../views/UserSet/editNick.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 修改手机号
        {
          path: '/editMobile',
          name: 'EditMobile',
          component: () => import('../views/UserSet/editMobile.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 修改邮箱
        {
          path: '/editEmail',
          name: 'EditEmail',
          component: () => import('../views/UserSet/editEmail.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

         // 修改邮箱
         {
          path: '/changePassword',
          name: 'ChangePassword',
          component: () => import('../views/UserSet/changePassword.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 聊天
        {
          path: '/chat',
          name: 'Chat',
          component: () => import('../views/Chat/index.vue'),
          meta: {
            isLogin: false,
            isFooter: true
          }
        },

        // php SocketIO 聊天
        {
          path: '/phpSocketIO',
          name: 'PhpSocketIO',
          component: () => import('../views/PhpSocketIO/index.vue'),
          meta: {
            isLogin: false,
            isFooter: false
          }
        },

        // golang SocketIO 聊天
        {
          path: '/golangSocketIO',
          name: 'GolangSocketIO',
          component: () => import('../views/GolangSocketIO/index.vue'),
          meta: {
            isLogin: false,
            isFooter: false
          }
        },

        // nodejs SocketIO 聊天
        {
          path: '/nodeSocketIO',
          name: 'NodeSocketIO',
          component: () => import('../views/NodeSocketIO/index.vue'),
          meta: {
            isLogin: false,
            isFooter: false
          }
        },

        // golang WebSocket 聊天
        {
          path: '/golangWebSocket',
          name: 'GolangWebSocket',
          component: () => import('../views/GolangWebSocket/index.vue'),
          meta: {
            isLogin: false,
            isFooter: false
          }
        },

        // php WebSocket 聊天
        {
          path: '/phpWebSocket',
          name: 'PhpWebSocket',
          component: () => import('../views/PhpWebSocket/index.vue'),
          meta: {
            isLogin: false,
            isFooter: false
          }
        }
    ],
    // 路由滚动行为
    scrollBehavior (to, from, savedPosition) {
      return {
        top: 0
      }
    }
  })
  
  export default router